package o;

import android.content.Context;
import android.content.Intent;
import com.huawei.appgallery.forum.base.card.bean.Section;
import o.brc.e;
import o.bww.h;

public class bwz {
    public static final String ˎ = (bqy.ˋ().ˏ().getPackageName() + ".forum.section.follow.action");

    public fjo<Boolean> ॱ(Context context, Section section, int i, String str, boolean z, boolean z2, boolean z3) {
        bqx.ˏ("FollowSectionManager", "follow section:" + i);
        final fjx o_fjx = new fjx();
        if (!z || doo.ˊ(bqy.ˋ().ˏ())) {
            final Section section2 = section;
            final int i2 = i;
            final String str2 = str;
            final boolean z4 = z2;
            final Context context2 = context;
            final boolean z5 = z;
            ((cbh) fho.ˏ().ˋ("User").ॱ(cbh.class)).ˎ(context, 1, z3).ˏ(new fjq<Boolean>(this) {
                final /* synthetic */ bwz ॱॱ;

                public void onComplete(fjo<Boolean> o_fjo_java_lang_Boolean) {
                    if (o_fjo_java_lang_Boolean.ˊ() && ((Boolean) o_fjo_java_lang_Boolean.ॱ()).booleanValue()) {
                        bxd o_bxd = new bxd();
                        o_bxd.ˋ(section2.ˊ());
                        o_bxd.ˏ(i2);
                        o_bxd.ˊ(str2);
                        ((brc) fho.ˏ().ˋ("Base").ॱ(brc.class)).ˋ(o_bxd, new e<bxd, bxb>(this) {
                            final /* synthetic */ AnonymousClass1 ˎ;

                            {
                                this.ˎ = r1;
                            }

                            public /* synthetic */ void ˋ(Object obj, Object obj2) {
                                ˏ((bxd) obj, (bxb) obj2);
                            }

                            public /* synthetic */ void ˏ(Object obj, Object obj2) {
                                ˋ((bxd) obj, (bxb) obj2);
                            }

                            public void ˋ(bxd o_bxd, bxb o_bxb) {
                            }

                            public void ˏ(bxd o_bxd, bxb o_bxb) {
                                if (o_bxb == null) {
                                    o_fjx.ॱ(Boolean.valueOf(false));
                                    return;
                                }
                                if (o_bxb.getResponseCode() == 0) {
                                    if (this.ˎ.ॱॱ.ˎ(o_bxb.getRtnCode_(), i2)) {
                                        o_fjx.ॱ(Boolean.valueOf(true));
                                        if (i2 == 0) {
                                            section2.ˊ(1);
                                        } else {
                                            section2.ˊ(0);
                                        }
                                        if (z4 || i2 == 1) {
                                            this.ˎ.ॱॱ.ˎ(context2, section2);
                                            return;
                                        }
                                        return;
                                    }
                                }
                                if (z5) {
                                    this.ˎ.ॱॱ.ˋ(o_bxb);
                                }
                                o_fjx.ॱ(Boolean.valueOf(false));
                            }
                        });
                    }
                }
            });
            return o_fjx.ॱ();
        }
        evk.ˏ(context, h.ʽॱ, 0).ˋ();
        o_fjx.ॱ(Boolean.valueOf(false));
        return o_fjx.ॱ();
    }

    private void ˋ(bxb o_bxb) {
        Context ˏ = bqy.ˋ().ˏ();
        if (o_bxb.getResponseCode() == 3) {
            ckv.ˎ(ˏ.getResources().getString(h.ʽॱ), 0);
            return;
        }
        ckv.ˎ(ˏ.getResources().getString(bse.ˏ.ॱ(o_bxb.getRtnCode_()).ˏ()), 0);
    }

    private boolean ˎ(int i, int i2) {
        if (i == 0) {
            return true;
        }
        if (i2 == 0 && 400002 == i) {
            return true;
        }
        return 1 == i2 && 400003 == i;
    }

    private void ˎ(Context context, Section section) {
        Intent intent = new Intent(ˎ);
        intent.putExtra("section", section);
        ll.ˏ(context).ˋ(intent);
    }
}
